# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php7-pecl-zstd
_pkgreal=zstd
pkgver=0.9.0
pkgrel=1
pkgdesc="PECL Zstandard extension."
url="https://pecl.php.net/package/zstd"
arch="all !armhf" # tests fails on armhf
license="MIT"
depends="php7-common"
makedepends="php7-dev autoconf re2c zstd-dev"
checkdepends="php7-openssl"
source="https://pecl.php.net/get/$_pkgreal-$pkgver.tgz"
builddir="$srcdir/$_pkgreal-$pkgver"
provides="php7-zstd=$pkgver-r$pkgrel" # for backward compatibility
replaces="php7-zstd" # for backward compatibility

build() {
	phpize7
	./configure --prefix=/usr --with-php-config=php-config7 --with-libzstd
	make
}

check() {
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test PHP_TEST_SHARED_EXTENSIONS=" \
		-d extension=/usr/lib/php7/modules/openssl.so \
		-d extension=modules/$_pkgreal.so"
}

package() {
	make INSTALL_ROOT="$pkgdir"/ install
	install -d "$pkgdir"/etc/php7/conf.d
	echo "extension=$_pkgreal.so" > "$pkgdir"/etc/php7/conf.d/$_pkgreal.ini
}

sha512sums="5bef5a49de423911f0a3f13bb2a5cd70a1c1debd04c35f1ec5bc0f91194e9c4a05b260ff627cf07e0018898372c0c51a05c72da4c04769438d7956461dae743a  zstd-0.9.0.tgz"
